package net.ixion.portal.utils.result;

import java.util.Map;

public class Result {

	/**
	 * 带状态的操作 比如登录有成功和失败
	 */
	private OperationState operationState = OperationState.DEFAULT;
	/**
	 * 操作结果数据 假设一个操作要返回很多的数据 一个用户名 一个产品 一个相关产品列表 一个产品的评论信息列表 我们以key
	 * value形式进行保存，页面获取data对象读取其对于的value即可
	 */
	private Map<String, Object> data;

	private String title = "";

	public Result() {
		super();
	}

	public Result(OperationState operationState, Map<String, Object> data,
			String title) {
		super();
		this.operationState = operationState;
		this.data = data;
		this.title = title;
	}

	/**
	 * 清空结果
	 */
	public void clear() {
		this.operationState = OperationState.DEFAULT;
		this.data.clear();
		this.title = "";
	}

	public Map<String, Object> getData() {
		return data;
	}

	public OperationState getOperationState() {
		return operationState;
	}

	public String getTitle() {
		return title;
	}

	public void setData(Map<String, Object> data) {
		this.data = data;
	}

	public void setOperationState(OperationState operationState) {
		this.operationState = operationState;
	}

	public void setTitle(String title) {
		this.title = title;
	}
}
